/**
 * Copyright (c) 2020 Coder League
 * All rights reserved.
 *
 * File：AliyunInterfaceController.java
 * History:
 *         2020年12月22日: Initially created, Chrise.
 */
package club.coderleague.cfss.controller.interfaces;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import club.coderleague.cfss.annotations.Request;
import club.coderleague.cfss.service.interfaces.AliyunInterfaceService;

/**
 * 阿里云接口控制器。
 * @author Chrise
 */
@Controller
@RequestMapping(InterfaceController.REQUEST_PREFIX + "/aliyun")
public class AliyunInterfaceController extends InterfaceController {
	@Autowired
	private AliyunInterfaceService aiService;
	
	/**
	 * 获取验证码。
	 * @author Chrise 2020年12月22日
	 * @param phone 手机号。
	 * @return 验证码发送结果。
	 */
	@ResponseBody
	@PostMapping("/getVercode.xhtml")
	@Request("获取验证码")
	public ModelMap getVercode(String userphone) {
		boolean result = this.aiService.sendVercode(userphone, getSession().getId());
		return createModelOnlyStatus(result);
	}
}
